package com.niuke;

import java.util.Scanner;

/**
 * 31. 二位伞的雨滴效应
 * https://www.bilibili.com/read/cv24971123
 */
public class NiukeMoni31buhui {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);

        String[] input = scanner.nextLine().split(" ");

        int[] data = new int[input.length];
        int left = 0;
        int right = 0;
        boolean isMinLeft = true;
        boolean isNode = true;
        boolean isLeft = true;
        for (int i = 0; i < input.length; i++) {
            data[i] = Integer.parseInt(input[i]);
            if (data[i] > data[0]) {
                isLeft = false;
            }
            if (i > 0) {
                if (data[i] < data[i - 1] && isMinLeft) {
                    left = data[i];
                } else {
                    isMinLeft = false;
                }
            }

            if (!isLeft) {
                if (data[i] <= data[0]) {
                    isNode = false;
                    break;
                } else {
                    right = Math.max(right, data[i]);
                    if (i == input.length - 1 && data[i] < data[i - 1] && data[i] > data[i - 2]) {
                        right = data[i];
                    }
                }
            }
        }

        if (isNode) {
            System.out.println("1 " + left + " " + right);
        } else {
            System.out.println("1 " + 0 + " " + 0);
        }

    }

}
